package com.easy.controller;

import com.easy.bean.Orderaddress;
import com.easy.service.IOrderaddressService;
import com.easy.util.LayData;
import com.easy.util.Page;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Controller
@RequestMapping("orderaddress")
public class OrderaddressController {
    @Autowired
    IOrderaddressService orderaddressService;

    @RequestMapping("list")
    @ResponseBody
    public LayData getOrderaddressList(Page page, String text){
        List<Orderaddress> list=orderaddressService.selectOrderaddress(page,text);
        int count=orderaddressService.OrderaddressCount(text);
        return new LayData(count,list);
    }

    @RequestMapping("delete")
    @ResponseBody
    public int deleteOrderaddress(int orderid){
        return orderaddressService.deleteOrderaddress(orderid);
    }

    @RequestMapping("add")
    @ResponseBody
    public int addOrderaddress(Orderaddress orderaddress){
        return orderaddressService.addOrderaddress(orderaddress);
    }

    @RequestMapping("edit")
    @ResponseBody
    public int editOrderaddress(Orderaddress orderaddress){
        return orderaddressService.editOrderaddress(orderaddress);
    }

    @RequestMapping("get")
    @ResponseBody
    public Orderaddress getOrderaddressById(int orderid){
        return orderaddressService.getOrderaddressById(orderid);
    }

}
